package com.test.qpbgboot.base.config;

import com.cloopen.rest.sdk.BodyType;
import com.cloopen.rest.sdk.CCPRestSmsSDK;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SMSConfig {

    @Value("${sms.server.ip}")
    private String serverIp;
    @Value("${sms.server.port}")
    private String serverPort;
    @Value("${sms.account.sid}")
    private String accountSid;
    @Value("${sms.account.token}")
    private String accountToken;
    @Value("${ams.app.id}")
    private String appId;

    @Bean
    public CCPRestSmsSDK getSmsSDK() {
        CCPRestSmsSDK smsSDK = new CCPRestSmsSDK();
        smsSDK.init(serverIp, serverPort);
        smsSDK.setAccount(accountSid, accountToken);
        smsSDK.setAppId(appId);
        smsSDK.setBodyType(BodyType.Type_JSON);
        return smsSDK;
    }

}
